package com.omt.tarjimdinek.domain.user.Service;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.log4j.Logger;

import com.omt.tarjimdinek.domain.user.dao.RoleDao;
import com.omt.tarjimdinek.domain.user.entity.Role;
import com.omt.tarjimdinek.support.GenericDao;
import com.omt.tarjimdinek.support.RepositoryImpl;

/**
 * Role manager implements
 * @author chabane
 *
 */
@Named("roleRepository")
@Singleton
public class RoleRepositoryImpl  extends RepositoryImpl<Role, Long> implements RoleRepository {

	private RoleDao roleDao; 
	
	@SuppressWarnings("unused")
	private static final Logger log = Logger.getLogger(RoleRepositoryImpl.class);

	@Inject
	public void setRoleDao(RoleDao roleDao) {
	   this.roleDao = roleDao;
	}

	/**
	  * Dao getter used by the {@link RepositoryImpl}.
	  */
	@Override
	public GenericDao<Role, Long> getDao() {
	   return roleDao;
	}     

	/**
     * {@inheritDoc}
     */
    @Override
    public Role getNew() {
        return new Role();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Role getNewWithDefaults() {
    	Role result = getNew();
        result.initDefaultValues();
        return result;
    }

	@Override
	public void create(Role aRole) {
		save(aRole);
	}

}
